{% extends '::base.html.twig' %}

{% block title %}
    {% if searchType == 0 %}
    Search for Partner
    {% else %}
    Search for Technology
    {% endif %}
{% endblock %}

{% block stylesheets %}
{{ parent() }}
<style>
    #main, .wrapper, #content, .entry, .content-frame, .frame {
        overflow: visible !important;
    }
</style>
{% endblock %}

{% block topbar %}
<div id="topbar" style="background: url('/images/blue.png') repeat-x scroll 0 0 #B0B0B0">
    <strong class="wrapper">
        {% if searchType == 0 %}
        Search for Partner
        {% else %}
        Search for Technology
        {% endif %}
    </strong>
</div>
{% endblock %}

{% block bodyclass %} class="fullwidth"{% endblock %}

{% block body %}
<div class="wrapper">
    <div id="content">
        <div class="entry">

            <form id="searchForm" action="{{ url('ttico_search_results') }}" method="post" {{ form_enctype(form) }}>
                <fieldset class="content-frame">
                    <legend>search</legend>
                    <b>Alexandria university inventions that are available for licensing through TTICO</b>

                    <div id="country">
                        {{ form_label(form.theme) }}
                        {{ form_errors(form.theme) }}
                        {{ form_widget(form.theme) }}
                    </div>

                    {{ form_rest(form) }}
                    <br />
                    <p>
                        <button type="submit">Search</button>
                    </p>
                </fieldset>
            </form>

            <div class="big-spacer"></div>
            
            <div id="search"></div>

        </div>
        <!-- END .entry -->

    </div>
    <!-- END #content -->      

</div>
<!-- END .wrapper -->
{% endblock %}

{% block javascripts %}
{{ parent() }}
<script>
    $('select').chosen();
    function requestResults(page){
        $.ajax({
            url: "{{ url('ttico_search_results') }}?page=" + page,
            data: $('#searchForm').serialize(),
            success: function(data) {
                $('#search').html(data);
            }
        });
    }

    $('#searchForm').submit(function (e) {
        e.preventDefault();
        requestResults(1);
    });
</script>
{% endblock %}